﻿using SD.Infrastructure.Repository.EntityFrameworkCore;
using SlamDunk.MES.Domain.Entities.DefinitionContext;
using SlamDunk.MES.Domain.IRepositories.Interfaces.DefinitionContext;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SlamDunk.MES.Repository.Implements.DefinitionContext
{
    /// <summary>
    /// 工艺段人员规范仓储实现
    /// </summary>
    public class SegmentPersonRuleRepository : EFEntityRepositoryProvider<SegmentPersonRule>, ISegmentPersonRuleRepository
    {
        #region # 获取工艺段人员规范列表 —— ICollection<SegmentPersonRule> Find(Guid segmentId)
        /// <summary>
        /// 获取工艺段人员规范列表
        /// </summary>
        /// <param name="segmentId">工艺段Id</param>
        /// <returns>工艺段人员规范列表</returns>
        public ICollection<SegmentPersonRule> Find(Guid segmentId)
        {
            IQueryable<SegmentPersonRule> personRules = base.Find(x => x.ProcessSegment.Id == segmentId);

            return personRules.ToList();
        }
        #endregion
    }
}
